const express = require("express");
const router = express.Router(); //创建路由模块
const artcate_handler = require("../router_handler/artcate"); //导入路由处理逻辑
// 导入验证数据中间件
const expressJoi = require("@escook/express-joi");
// 获取文章数据列表
router.get("/cates", artcate_handler.getArticleCates);
// 新增文章分类
// 导入文章分类验证模块
const schema = require("../sechma/artcate");
router.post(
  "/addcates",
  expressJoi(schema.add_cate_schema),
  artcate_handler.addArticleCates
);
// 删除文章分类
router.get(
  "/deletecate/:id",
  expressJoi(schema.delete_cate_schema),
  artcate_handler.deleteCateById
);
// 根据id获取文章分类
router.get(
  "/cates/:id",
  expressJoi(schema.delete_cate_schema),
  artcate_handler.getArticleById
);
// 根据id更新文章分类
router.post(
  "/updatecate",
  expressJoi(schema.update_cate_schema),
  artcate_handler.updateCateById
);
module.exports = router;
